home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-01-09 | 2.8 KB | 119 lines | [TEXT/PJMM] |
-
- UNIT MyPrintStuff;
-
- INTERFACE
-
- USES
- ROM85, PrintTraps, PlotGlobals, Misc, myFileStuff, Solve;
-
- PROCEDURE doPageSet;
- PROCEDURE doPrint;
-
- IMPLEMENTATION
-
- PROCEDURE PrintMe;
- CONST
- LaserWriter = 2;
- VAR
- theWorld : rect;
- pstate : penstate;
- BEGIN
- theWorld := PicRect;
- IF Option = 1 THEN
- theWorld := PicRect
- ELSE IF Option = 2 THEN
- theWorld := PageRect
- ELSE
- doMessage('Printing Rectangle Problem', '', '', '');
- GetPenState(pstate);
- PrintingPic := OpenPicture(theWorld);
- PrQDStuff(theWorld, LaserWriter);
- ClosePicture;
- SetPenState(pstate);
- DrawPicture(PrintingPic, theWorld);
- KillPicture(PrintingPic);
- END;
-
- PROCEDURE doPrint;
- VAR
- DoIt : boolean;
- myPrint : THPrint;
- myPrStatus : TPrStatus;
- myPrPort : TPPrPort;
- PrRect : rect;
- str1 : str255;
- temp : GrafPtr;
- numCopies : integer;
- count : integer;
- prStatus : TPrStatus;
- BEGIN {1}
- IF DrawingPic <> NIL THEN
- BEGIN {2}
- myPrint := PlotDocHandle^^.print;
- getport(temp);
- PrOpen;
- IF PrError = noErr THEN
- BEGIN {3}
- DoIt := PrValidate(myPrint);
- DoIt := PrJobDialog(myPrint);
- IF PrError <> noErr THEN
- doMessage('Printer error in job dialog', '', '', '');
- IF DoIt THEN
- BEGIN {4}
- myPrPort := PrOpenDoc(myPrint, NIL, NIL);
- IF PrError = noErr THEN
- BEGIN {5}
- numCopies := myPrint^^.prJob.iCopies;
- FOR count := 1 TO numCopies DO
- BEGIN {6}
- PrOpenPage(myPrPort, NIL);
- IF PrError = noErr THEN
- BEGIN {7}
- { print something dummy!}
- PageRect := myPrint^^.prInfo.rPage;
- PrintMe;
- END { 7}
- ELSE
- doMessage('OpenPage error', 'cannot print this page', '', '');
- PrClosePage(myPrPort);
- IF PrError <> noErr THEN
- doMessage('ClosePage error', 'cannot close this page', '', '');
- END; {6}
- END { 5}
- ELSE
- doMessage('OpenDoc error', 'cannot print', '', '');
- PrCloseDoc(myPrPort);
- IF PrError <> noErr THEN
- doMessage('CloseDoc error', '', '', '');
- IF (myPrint^^.prJob.bJDocLoop = bSpoolLoop) AND (PrError = noerr) THEN
- PrPicFile(myPrint, NIL, NIL, NIL, prStatus);
- END; {4}
- END; {3}
- PrClose;
- setport(temp);
- END;{2}
- END; {of proc 1}
-
-
- PROCEDURE doPageSet;
- VAR
- DoIt : boolean;
- myPrint : THPrint;
- BEGIN
- myPrint := PlotDocHandle^^.print;
- PrOpen;
- IF PrError = noErr THEN
- BEGIN
- DoIt := PrValidate(myPrint);
- DoIt := PrStlDialog(myPrint);
- IF PrError <> noErr THEN
- doMessage('Printer error in style dialog', '', '', '')
- ELSE
- PageRect := myPrint^^.prInfo.rpage;
- END
- ELSE
- doMessage('Cannot perform PrOpen!', '', '', '');
- PrClose;
- END;
-
- END. {of unit}